Skip to content

Conversation

@gperdrizet
Copy link

Splitting on ';' first and then filtering '--' was resulting in no queries directly preceded by a comment ever running.

For any query preceded by a comment, the result of splitting on ';' would be a block of lines something like this:

-- A comment line
SELECT * FROM observations LIMIT 10;

The '--' filter for comments was then excluding it. This parsing issue was causing the example solution to be non-functional and preventing any queries preceded by a comment from running. The correct approach is to:

  1. Split the query document into a line array
  2. Remove empty lines
  3. Remove comment lines
  4. Concatenate the cleaned line array back to a single string
  5. Then split on ';' to recover each each individual query as a single line string

Now the commenting system works as intended, and the comment filtering logic is no longer necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant